home *** CD-ROM | disk | FTP | other *** search
- /* Amiga menu bar related stuff.
- Copyright (C) 1986, 1988, 1993, 1994 Free Software Foundation, Inc.
-
- This file is part of GNU Emacs.
-
- GNU Emacs is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
- any later version.
-
- GNU Emacs is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNU Emacs; see the file COPYING. If not, write to
- the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
- /* Original Amiga version by David Gay,
- * Emacs 19 version by Carsten Heyl,
- * took lot of code from xmenu.c
- */
-
- #include <exec/types.h>
- #include <libraries/gadtools.h>
- #include <intuition/intuition.h>
- #include <proto/exec.h>
- #include <proto/dos.h>
- #include <proto/gadtools.h>
- #include <proto/intuition.h>
- #include "config.h"
- #include "lisp.h"
- #include "frame.h"
- #include "amiga.h"
-
- #ifdef USE_PROTOS
- #include "protos.h"
- #endif
-
- #ifndef GTMN_NewLookMenus
- #define GTMN_NewLookMenus GT_TagBase+67
- #endif
-
- #if 0
- static struct Menu *emacs_menu;
- static char *emacs_menu_strings;
- static APTR win_vi;
- #endif
- struct Library *GadToolsBase;
-
- void suspend_menus(FRAME_PTR f)
- {
- if (EMACS_WIN(f))
- {
- ClearMenuStrip(EMACS_WIN(f));
- if (EMACS_VI(f))
- {
- FreeVisualInfo(EMACS_VI(f));
- EMACS_VI(f) = 0;
- }
- }
- }
-
- int resume_menus(FRAME_PTR f)
- {
- if (EMACS_WIN(f) && EMACS_MENU(f))
- {
- EMACS_VI(f) = GetVisualInfo(EMACS_WIN(f)->WScreen, TAG_END);
-
- if (!EMACS_VI(f) || !LayoutMenus(EMACS_MENU(f), EMACS_VI(f),
- GTMN_NewLookMenus, 1L,
- TAG_END))
- {
- if (EMACS_VI(f)) FreeVisualInfo(EMACS_VI(f));
- Famiga_delete_menus(f);
-
- return FALSE;
- }
- SetMenuStrip(EMACS_WIN(f), EMACS_MENU(f));
- }
- return TRUE;
- }
-
- static
- void Famiga_delete_menus(FRAME_PTR f)
- {
- check_intuition();
-
- suspend_menus(f);
- if (EMACS_MENU(f)) FreeMenus(EMACS_MENU(f));
- EMACS_MENU(f) = 0;
- if (EMACS_MENU_STRINGS(f)) free(EMACS_MENU_STRINGS(f));
- EMACS_MENU_STRINGS(f) = 0;
- }
-
-
- void syms_of_amiga_fns(void);
- void init_amiga_fns(void);
- void syms_of_amiga_xmenu(void);
- void init_amiga_xmenu(void);
-
- void syms_of_amiga_menu(void)
- {
- syms_of_amiga_fns();
- syms_of_amiga_xmenu();
- }
-
- void init_amiga_menu(void)
- {
- GadToolsBase = OpenLibrary("gadtools.library", 0);
- if (!GadToolsBase) _fail("gadtools.library required");
- init_amiga_fns();
- }
-
- void cleanup_amiga_menu(void)
- {
- #ifdef MULTI_FRAME
- you lose
- #endif
- suspend_menus(selected_frame);
- if (EMACS_MENU(f)) Famiga_delete_menus(selected_frame);
- if (GadToolsBase) CloseLibrary(GadToolsBase);
- }
-
-